using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;

namespace OpenWaves.ActivityFeed.Web
{
    [DefaultImplementation(typeof(UpdateDtoBuilder))]
    [ContractClass(typeof(UpdateDtoBuilderContract))]
    public interface IUpdateDtoBuilder
    {
        UpdateDto BuildUpdateDto(Update update);

        [SuppressMessage("Microsoft.Naming", "CA1704:Identifiers should be spelled correctly")]
        IEnumerable<UpdateDto> BuildUpdateDtos(IEnumerable<Update> updates);
    }

    [ContractClassFor(typeof(IUpdateDtoBuilder))]
    abstract class UpdateDtoBuilderContract : IUpdateDtoBuilder
    {
        public UpdateDto BuildUpdateDto(Update update)
        {
            Contract.Requires<ArgumentNullException>(update != null);
            Contract.Ensures(Contract.Result<UpdateDto>() != null);

            throw new System.NotImplementedException();
        }

        public IEnumerable<UpdateDto> BuildUpdateDtos(IEnumerable<Update> updates)
        {
            Contract.Requires<ArgumentNullException>(updates != null);
            Contract.Ensures(Contract.Result<IEnumerable<UpdateDto>>() != null);

            throw new NotImplementedException();
        }
    }
}